package com.example.myspringframework.convert;

import com.example.myspringframework.beans.BeansException;
import com.example.myspringframework.beans.factory.FactoryBean;

import java.util.HashSet;
import java.util.Set;

/**
 * 添加一些自定义的转换器
 */
public class ConvertersFactoryBean implements FactoryBean<Set<?>> {
    @Override
    public Set<?> getObject() throws BeansException {
        HashSet<Object> hashSet = new HashSet<>();
        // 可以添加多个自定义转换器
        StringToLocalDateConverter converter = new StringToLocalDateConverter("yyyy-MM-dd");
        hashSet.add(converter);
        return hashSet;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
